package com.ruix.app.model;

import org.json.JSONObject;

/**
 * Created by hadexs on 2017/4/22.
 */

public class OssToken {
    private String accessKeyId;
    private String accessKeySecret;
    private String endpoint;
    private String bucketName;
    private String uploadFilePath;
    private String securityToken;
    private long  expiration;

    public OssToken parse(JSONObject object){
        if (object != null){
            setAccessKeyId(object.optString("AccessKeyId",""));
            setAccessKeySecret(object.optString("AccessKeySecret",""));
            setEndpoint(object.optString("endpoint",""));
            setBucketName(object.optString("bucketName",""));
            setUploadFilePath(object.optString("uploadFilePath",""));
            setSecurityToken(object.optString("SecurityToken",""));
        }
        return this;
    }

    public String getAccessKeyId() {
        return accessKeyId;
    }

    public void setAccessKeyId(String accessKeyId) {
        this.accessKeyId = accessKeyId;
    }

    public String getAccessKeySecret() {
        return accessKeySecret;
    }

    public void setAccessKeySecret(String accessKeySecret) {
        this.accessKeySecret = accessKeySecret;
    }

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    public String getBucketName() {
        return bucketName;
    }

    public void setBucketName(String bucketName) {
        this.bucketName = bucketName;
    }

    public String getUploadFilePath() {
        return uploadFilePath;
    }

    public void setUploadFilePath(String uploadFilePath) {
        this.uploadFilePath = uploadFilePath;
    }

    public String getSecurityToken() {
        return securityToken;
    }

    public void setSecurityToken(String securityToken) {
        this.securityToken = securityToken;
    }

    public long getExpiration() {
        return expiration;
    }

    public void setExpiration(long expiration) {
        this.expiration = expiration;
    }

    @Override
    public String toString() {
        return "OssToken{" +
                "accessKeyId='" + accessKeyId + '\'' +
                ", accessKeySecret='" + accessKeySecret + '\'' +
                ", endpoint='" + endpoint + '\'' +
                ", bucketName='" + bucketName + '\'' +
                ", uploadFilePath='" + uploadFilePath + '\'' +
                ", securityToken='" + securityToken + '\'' +
                '}';
    }
}
